﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;

namespace Feelingme.ShareMSDN
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            AddBrowserSpecificStyle();
        }

        private void AddBrowserSpecificStyle()
        {
            if (Request.Browser.Browser == "IE")
            {
                var style = String.Format(CultureInfo.InvariantCulture,
                    "App_Themes/Classic/css/style-ie{0}.css",
                    Request.Browser.MajorVersion);

                HtmlGenericControl link = new HtmlGenericControl("link");
                link.Attributes["rel"] = "stylesheet";
                link.Attributes["type"] = "text/css";
                link.Attributes["href"] = style;

                this.Header.Controls.Add(link);
            }
        }

        public string GetVersion()
        {
            return GetType().BaseType.Assembly.GetName().Version.ToString();
        }
    }
}
